package com.mai.erp.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mai.erp.domain.Dispatch;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mai.erp.domain.vo.ProductQueueVO;

import java.util.List;

/**
 * @author wang
 * @description 针对表【dispatch(产品件与工位的调度关系表)】的数据库操作Service
 * @createDate 2025-06-16 10:21:26
 */
public interface DispatchService extends IService<Dispatch> {

    default List<Dispatch> getByWsId(Integer workStationId) {
        return this.list(new LambdaQueryWrapper<Dispatch>()
                .eq(Dispatch::getWsid, workStationId));
    }

    default Long getCountByWsId(Integer workStationId) {
        return this.count(new LambdaQueryWrapper<Dispatch>()
                .eq(Dispatch::getWsid, workStationId));
    }

    void proceed(Integer workStationId);


    void complete(Integer workStationId);

    default List<Dispatch> getQueueIngDispatchesByWsId(Integer workStationId){
        return this.list(new LambdaQueryWrapper<Dispatch>()
                .eq(Dispatch::getWsid, workStationId)
                .ne(Dispatch::getStatus, 3));
    }

    List<ProductQueueVO> getQueueIngDispatches(Integer workStationId);
}
